<#include "/layout/layout.ftl">
<#import "/layout/macro.ftl" as macro>
<#import "/layout/select.ftl" as my/>
<#assign css>
<#--此ftl中用到的css-->
</#assign>
<#assign js>
<#--此ftl中用到的js-->
<script>
	$(".btn-submit").click(function () {
		// 校验表单合法
		var bootstrapValidator = $(".form-edit").data('bootstrapValidator');
		bootstrapValidator.validate();
		if(bootstrapValidator.isValid()){
			$.ajax({
				type: "POST",
				url: "/user/edit",
				data: $(".form-edit").serialize(),
				dataType: "JSON",
				success: function(res){
					layer.msg(res.message, {time: 2000
					}, function(){
						location.href="/user/index";
					});
				}
			});
		}else{
			return false;
		}
	});

	$('.form-edit').bootstrapValidator({
		message: '请输入有效值',
		feedbackIcons: {
			valid: 'glyphicon glyphicon-ok',
			invalid: 'glyphicon glyphicon-remove',
			validating: 'glyphicon glyphicon-refresh'
		}
	});

</script>
</#assign>
<@layout title="编辑" active="user">
<!-- Content Header (Page header) -->
<section class="content-header">
	<h1>
		<#if isAdd>
            新增
        <#else>
            编辑
        </#if>
		<small>user详细信息</small>
	</h1>
	<ol class="breadcrumb">
		<li><a href="/"><i class="fa fa-home"></i> 管理后台</a></li>
		<li><a href="#"><i class="fa fa-list-ul"></i> user管理</a></li>
		<li class="active"><i class="fa fa-edit"></i>
		    <#if isAdd>
                新增
            <#else>
                编辑
            </#if>
		</li>
	</ol>
</section>
<!-- Main content -->
<section class="content">
	<div class="row">
		<div class="col-md-12">
			<!-- Default box -->
			<div class="box  box-primary">
				<form class="form-horizontal form-edit" method="post" action="user/edit">
					<div class="box-body">
						<input type="hidden" id="id" name="id" value="${user.id!}">
						<input type="hidden" id="isAdd" name="isAdd" value="${isAdd?string('true','false')}">
						<div class="form-group">
							<label class="col-sm-2 control-label">：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入" id="username" name="username" class="form-control" type="text" value="${user.username!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入" id="password" name="password" class="form-control" type="text" value="${user.password!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入" id="email" name="email" class="form-control" type="text" value="${user.email!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入" id="phone" name="phone" class="form-control" type="text" value="${user.phone!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入" id="registerDate" name="registerDate" class="form-control" type="text" value="${user.registerDate!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入" id="lastpasswordresetdate" name="lastpasswordresetdate" class="form-control" type="text" value="${user.lastpasswordresetdate!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">是否启用：</label>
							<div class="col-sm-10">
							    <@my.select id="enabled" datas=getDict('IS_NOT')  value="${user.enabled!}" defaultValue="请选择"/>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">微信openid：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入微信openid" id="openId" name="openId" class="form-control" type="text" value="${user.openId!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">微信unionid：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入微信unionid" id="unionId" name="unionId" class="form-control" type="text" value="${user.unionId!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">昵称：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入昵称" id="nickName" name="nickName" class="form-control" type="text" value="${user.nickName!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">性别：</label>
							<div class="col-sm-10">
							    <@my.select id="gender" datas=getDict('USER_SEX')  value="${user.gender!}" defaultValue="请选择"/>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入" id="language" name="language" class="form-control" type="text" value="${user.language!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入" id="city" name="city" class="form-control" type="text" value="${user.city!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入" id="province" name="province" class="form-control" type="text" value="${user.province!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入" id="country" name="country" class="form-control" type="text" value="${user.country!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">头像：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入头像" id="avatarUrl" name="avatarUrl" class="form-control" type="text" value="${user.avatarUrl!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入" id="smsCode" name="smsCode" class="form-control" type="text" value="${user.smsCode!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入" id="smsTime" name="smsTime" class="form-control" type="text" value="${user.smsTime!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">代收款余额：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入代收款余额" id="collectBal" name="collectBal" class="form-control" type="text" value="${user.collectBal!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入" id="points" name="points" class="form-control" type="text" value="${user.points!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入" id="vipLevel" name="vipLevel" class="form-control" type="text" value="${user.vipLevel!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">是否同意协议 0 否 1 是：</label>
							<div class="col-sm-10">
							    <@my.select id="isProtocol" datas=getDict('IS_NOT')  value="${user.isProtocol!}" defaultValue="请选择"/>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">个人签名：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入个人签名" id="signature" name="signature" class="form-control" type="text" value="${user.signature!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">是否已实名 0 否 1 是：</label>
							<div class="col-sm-10">
							    <@my.select id="isCertifacate" datas=getDict('IS_NOT')  value="${user.isCertifacate!}" defaultValue="请选择"/>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">是否同意骑手协议0否1是：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入是否同意骑手协议0否1是" id="isRider" name="isRider" class="form-control" type="text" value="${user.isRider!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">是否已认证师傅0否1认证中2已认证：</label>
							<div class="col-sm-10">
							    <@my.select id="isMaster" datas=getDict('IS_NOT')  value="${user.isMaster!}" defaultValue="请选择"/>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">骑手/师傅状态,0退出,1登入：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入骑手/师傅状态,0退出,1登入" id="masterStatus" name="masterStatus" class="form-control" type="text" value="${user.masterStatus!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">账户余额：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入账户余额" id="accountBalance" name="accountBalance" class="form-control" type="text" value="${user.accountBalance!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入" id="serviceType" name="serviceType" class="form-control" type="text" value="${user.serviceType!}" >
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">分站ID：</label>
							<div class="col-sm-10">
								<input required placeholder="请输入分站ID" id="agentId" name="agentId" class="form-control" type="text" value="${user.agentId!}" >
							</div>
						</div>

					<div class="box-footer">
						<button type="button" class="btn btn-default btn-back">返回</button>
						<button type="button" class="btn btn-info pull-right btn-submit">提交</button>
					</div>

				</form>
			</div>
			<!-- /.box -->
		</div>
	</div>
</section>
<!-- /.content -->
</@layout>
